package com.bgrconsulting.stockorderentry.service.converter;

import java.util.ArrayList;
import java.util.Collection;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;

import com.bgrconsulting.stockorderentry.service.model.Order;
import com.bgrconsulting.stockorderentry.service.model.OrderDetails;


import com.bgrconsulting.stockorderentry.service.converter.OrderConverter;

@XmlRootElement(name = "OrderDetails")
public class OrderDetailsConverter {
private OrderDetails enity;
	
	public OrderDetailsConverter(OrderDetails orderDetails) {
		enity = orderDetails;
	}
	
	public OrderDetailsConverter() {
		enity = new OrderDetails();
	}
	
	@XmlElement(name="order")	
	public OrderConverter[] getOrders() {
		
		OrderConverter[] oc = new OrderConverter[enity.getOrders().length]; 
		
		Order[] orders = enity.getOrders();
		
		for(int i=0; i<orders.length; i++) {
			oc[i] = new OrderConverter(orders[i]);
		}
		
		return oc;
	}

}
